import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
export 'package:provider/provider.dart';

typedef IStoreWidgetBuilder = Widget Function(BuildContext context);

class IStore extends StatelessWidget {
  final IStoreWidgetBuilder builder;
  final List<SingleChildCloneableWidget> providers;
  IStore({
    @required this.builder,
    @required this.providers,
  });

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: providers,
      child: _IStore(
        builder: builder,
      ),
    );
  }
}

class _IStore extends StatelessWidget {
  final IStoreWidgetBuilder builder;

  _IStore({
    @required this.builder,
  });

  @override
  Widget build(BuildContext context) {
    return builder(context);
  }
}
